package com.example.springboot.mybatis.dao;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import com.example.springboot.mybatis.entity.User;
import java.util.List;


/**
 * 基于注解方式编写sql语句，开发中不适用，维护成本太高
 */
public interface UserDaoMapper {

	@Select("select id,username as username,password from m_user where id=#{id}")
	public User getUserById(Integer id);

	
	@Select("select id,username as username,password from m_user where username=#{name}")
	public List<User> getUserByPage(String name);
//	自增长id,使用options配置返回id值
//	@Options(useGeneratedKeys=true,keyProperty="id",keyColumn="id")
	@Insert("insert into m_user(id,username,password) values(#{id},#{username},#{password})")
	public void saveUser(User user);
}
